package com.mezz.bones.user.application.executor.cmd.impl;

import com.mezz.bones.user.application.domain.cmd.TenantInfoCreateCmd;
import com.mezz.bones.user.application.executor.cmd.ITenantInfoExecutor;
import com.mezz.bones.user.application.repository.ITenantInfoRepository;
import com.mezz.bones.user.client.domain.entity.TenantInfo;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @Author: zhuang
 * @Date: 2025/6/27 17:22
 * @Description: TODO
 * @Version: 1.0
 **/

@Service
@Slf4j
@AllArgsConstructor
public class TenantInfoExecutorImpl implements ITenantInfoExecutor {

    private final ITenantInfoRepository tenantInfoRepository;

    @Override
    public void execTenantInfoCreateCmd(TenantInfoCreateCmd cmd) {

        TenantInfo add = new TenantInfo();
        add.setTenantCode(cmd.getTenantCode());
        add.setUsername(cmd.getUsername());
        add.setPassword(cmd.getPassword());
        add.setCreateBy("0");
        add.setCreateName("admin");
        add.setCreateTime(new Date());
        add.setUpdateBy("0");
        add.setUpdateName("admin");
        add.setUpdateTime(new Date());
        add.setIsDel(0);
        tenantInfoRepository.save(add);
    }
}
